<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>INSPINIA | 密码重置</title>

    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/font-awesome/css/font-awesome.css" rel="stylesheet">
    <link href="/static/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/static/css/animate.css" rel="stylesheet">
    <link href="/static/css/style.css" rel="stylesheet">
    <link href="/static/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link rel="shortcut icon" href="/static/img/logo.ico" />

</head>

<body class="gray-bg">

    <div class="middle-box text-center loginscreen   animated fadeInDown">
        <div>
{#            <div>#}
{##}
{#                <h1 class="logo-name" style="text-align:center">ITAdmin</h1>#}
{##}
{#            </div>#}
            <h3>ITAdmin 密码重置</h3>
            <p>请输入您的新密码.</p>
            <form class="m-t" role="form" action="login.html">
                <div class="form-group">
                    <input type="password" class="form-control" placeholder="请输入密码" required="" id="p1">
                </div>
                <div class="form-group">
                    <input type="password" class="form-control" placeholder="请再次输入密码" required="" id="p2">
                </div>
                <button type="button" class="btn btn-primary block full-width m-b" id="rest">确定</button>
            </form>
        </div>
    </div>

    <!-- Mainly scripts -->
</body>
<script src="/static/js/jquery-2.1.1.js"></script>
<script src="/static/js/plugins/sweetalert/sweetalert.min.js"></script>
<script type="text/javascript">
    $.ajaxSetup({
                data: {csrfmiddlewaretoken: '{{ csrf_token }}'},
    });
    $(function () {
        $("#rest").click(function () {
            var p1 = $("#p1").val();
            var p2 = $("#p2").val();
            if (p1 !== p2) {
                swal("错误", "两次输入密码不一致", "error");
                return;
            } else {
                $.post(location.href, {password:p1}, function (data) {
                    if (data.status == 1) {
                        location.href = "{% url 'login' %}";
                    } else {
                        swal("错误", "重置密码失败", "error");
                        return;
                    }
                });
            }
        });
    });
</script>

</html>
